package com.yh.controller;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.yh.bean.Desk;
import com.yh.service.ManageService;


@Controller
@Scope("prototype")
@RequestMapping("/desk")
public class MyDeskController {
	@Autowired
	private ManageService service;
	
	//查询所有desk
	@RequestMapping("/queryDesk")
	@ResponseBody
	public List<Desk> queryDesk(){
		System.out.println("desk方法....................................................");
		
		List<Desk> listDesk=service.queryDesk();
		
		return listDesk;
	}
	
	//更改desk
	@RequestMapping("/updateDesk")
	@ResponseBody
	public String updateDesk(@RequestBody List<Desk> desks){
		
		for(Desk d:desks){
			System.out.println(d.getId()+"0000000"+d.getState());
		}
		int a=service.updateDesk(desks);
		return "success";
	}
	

}
